/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package servlets;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author TOSHIBA
 */
public class ShowData extends HttpServlet {
   
    /** 
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        String username = request.getParameter("username");
        String nama_lengkap = request.getParameter("nama_lengkap");
        String alamat = request.getParameter("alamat");
        String jenis_kelamin = request.getParameter("jenis_kelamin");
        String pilihan_pertanyaan = request.getParameter("pilihan_pertanyaan");
        String jawaban_pertanyaan = request.getParameter("jawaban_pertanyaan");
        String foto = request.getParameter("foto");
        String tanggal_login = request.getParameter("tanggal_login");
        PrintWriter out = response.getWriter();
        
        try {
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Form Pendaftaran</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<h2>Data Member Baru</h2>");
            out.println("<table border='1' cellpadding='3' cellspacing='2'>" +
            "<tr><td>Username: </td><td>" + username + "</td></tr>" +
            "<tr><td>Nama Lengkap: </td><td>" + nama_lengkap +
            "<tr><td>Alamat: </td><td>" + alamat +
            "<tr><td>Jenis Kelamin: </td><td>" + jenis_kelamin +
            "<tr><td>Pilihan Pertanyaan: </td><td>" + pilihan_pertanyaan +
            "<tr><td>Jawaban Pertanyaan: </td><td>" + jawaban_pertanyaan + 
            "<tr><td>Foto: </td><td>" + foto +"</td></tr>" + "</tsble>");
            out.println("</body>");
            out.println("</html>");
        } finally { 
            out.close();
        }
    } 

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** 
     * Handles the HTTP <code>GET</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    } 

    /** 
     * Handles the HTTP <code>POST</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }

    /** 
     * Returns a short description of the servlet.
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}
